# 写一个函数, 来求 n 的阶乘(n 是正整数)

# def factor(n):
#     result = 1
#     for i in range(1, n + 1):
#         result *= i
#     return result


# n! => n * (n - 1)!
# 1! => 1
def factor(n):
    if n == 1:
        return 1
    return n * factor(n + 1)


print(factor(5))
